package com.sgcc.system.api.factory;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.sgcc.common.core.web.domain.AjaxResult;
import com.sgcc.system.api.RemoteMenuService;
import com.sgcc.system.api.domain.SysMenu;

import feign.hystrix.FallbackFactory;

/**
 * 用户服务降级处理
 * 
 * @author sgcc
 */
@Component
public class RemoteMeunFallbackFactory implements FallbackFactory<RemoteMenuService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteMeunFallbackFactory.class);

    @Override
    public RemoteMenuService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteMenuService()
        {

			@Override
			public AjaxResult addIsc(SysMenu menu) {
				// TODO Auto-generated method stub
				return AjaxResult.error("ISC添加菜单失败请稍后在试~");
			}

			@Override
			public AjaxResult editIsc(SysMenu menu) {
				// TODO Auto-generated method stub
				return AjaxResult.error("ISC更新菜单失败请稍后在试~");
			}

			@Override
			public AjaxResult getInfoIsc(String menuId) {
				// TODO Auto-generated method stub
				return AjaxResult.error("ISC获取菜单信息失败请稍后在试~");
			}
            

			
        };
    }
}
